//
//
//
//
//
//
//
//
//
// DCUtil.h
//

#ifndef _DC_UTIL_H_
#define _DC_UTIL_H_

#include "stdafx.h"

/*

struct POINT
{
	int x;
	int y;
};
*/
class DCUtil
{
public:
	enum RANG_STATE
	{
		RANG_INITIAL = 1,
		RANG_STARED,
		RANT_PROCESSING,
		RANG_ENDED,
	};

	enum EDGE_POS
	{
		EDGE_POS_NONE = 1,
		EDGE_POS_IN,
		EDGE_POS_LEFT,
		EDGE_POS_LEFT_BOTTOM,
		EDGE_POS_BOTTOM,
		EDGE_POS_RIGH_BOTTOM,
		EDGE_POS_RIGHT,
		EDGE_POS_RIGHT_TOP,
		EDGE_POS_TOP,
		EDGE_POS_LEFT_TOP,
	};
public:
	DCUtil();
	DCUtil(HDC hdc);
	DCUtil(HDC hdc, POINT start);
	DCUtil(HDC hdc, int x, int y);

	~DCUtil();

	POINT GetStartPoint(void);
	POINT GetEndPoint(void);

	void CkStart(POINT start);
	void CkEnd(POINT end);
	void PointTo(POINT to);
	void ToRect(RECT& rect);
	void Clr(void);
	void Print(void);
	void SetDC(const HDC& hdc);
	int GetWidth(void);
	int GetHeight(void);
	bool IsStart(void);

	bool IsInRang(POINT point);
	bool IsOnEdge(POINT point, EDGE_POS& cursorEdge);


	void ReRangeDC(POINT a, POINT b, EDGE_POS edgeStatus);

	LONG& Left(void);
	LONG& Right(void);
	LONG& Top(void);
	LONG& Bottom(void);

	DCUtil::RANG_STATE State(void);

	HDC _hdc;
	POINT _start;
	POINT _end;
	RANG_STATE _state;
};




#endif // _DC_UTIL_H_